<template>
  <div v-loading="loading">
    <div class="top display-flex justify-content align-items">
      只为做最好的给你
    </div>
    <div class="content">
      <div class="title">
        <img src="../assets/image/titleL.png" width="500" alt="" title=""/>
        <span>设计服务</span>
        <img src="../assets/image/titleR.png" width="500" alt="" title=""/>
      </div>
      <el-row :gutter="20">
        <el-col :span="12" v-for="(list,index) in sheJifwData" :key="index">
          <div class="grid-content">
            <el-card class="sjfw" shadow="hover">
              <img :src="list.image" width="100" alt="" title=""/>
              <p>{{list.name}}</p>
              <p>{{list.description}}</p>
            </el-card>
          </div>
        </el-col>
      </el-row>
    </div>
    <div class="SBZS SBAL">
      <div class="title">
        <img src="../assets/image/titleL.png" width="500" alt="" title=""/>
        <span>精选案例</span>
        <img src="../assets/image/titleR.png" width="500" alt="" title=""/>
      </div>
      <el-row :gutter="20">
        <el-col :span="6" v-for="(list,index) in banQuanALListData" :key="index">
          <div class="grid-content">
            <el-card class="box-card">
              <div class="text item">
                <img :src="list.image" height="200" :alt="list.name" title=""/>
                <p>{{list.name}}</p>
                <p>{{list.description}}</p>
              </div>
            </el-card>
          </div>
        </el-col>

      </el-row>
    </div>
  </div>
</template>

<script>
  export default {
    name: "sjfw",
    data() {
      return {
        loading: false,
        tabPosition: 'left',

        sheJifwID: 0,
        sheJifwData: [],

        banQuanALListData:[],
      }
    },

    methods: {
      handleClick(tab, event) {
        // console.log(tab, event);
      },
      //每屏列表(获取设计服务详情)
      getClassifyData(id) {
        let that = this;
        this.$http
          .post(this.$api.default.MP,{cid : id},)
          .then(res => {
            // console.log('数据', res);
            for(var i = 0;i < res.data.length;i++){
              res.data[i].image = that.$api.default.url_ + res.data[i].image
            }
            that.sheJifwData = res.data;
          }).catch(error => {
        })
          .then(() => {
          });
      },
      //每屏分类(获取设计服务ID)
      getClassifyList() {
        this.sheJifwID = localStorage.getItem('sheJifwID');
        // console.log(localStorage.getItem('sheJifwID'))
        if(this.sheJifwID){
          this.getClassifyData(this.sheJifwID)
          return
        }
        // console.log('请求LOGO');
        let that = this;
        this.$http
          .post(this.$api.default.MPFL,{type : 'screen'},)
          .then(res => {
            // console.log('数据', res);
            //设计服务ID
            if(res.data[0].name == '设计服务'){
              that.sheJifwID = res.data[0].id;
              localStorage.setItem('sheJifwID',res.data[0].id);
              that.getClassifyData(that.sheJifwID)
            }

          }).catch(error => {
        })
          .then(() => {
          });
      },
      //案例--版权案例
      sheJiAL(){
        let that = this;
        this.$http
          .post(this.$api.default.category,{type:'design'},)
          .then(res => {
            // console.log('数据', res)
            //设置初始值
            that.sheJiALlist(res.data[0].id)
          }).catch(error => {
        })
          .then(() => {
          });
      },
      //案例--版权列表
      sheJiALlist(id){
        // console.log(id)
        let that = this;
        this.$http
          .post(this.$api.default.SJ,{page: 1,cid: id,listRows: 8})
          .then(res => {
            // console.log('数据', res);
            for(var i = 0;i < res.data.data.length;i++){
              res.data.data[i].image = that.$api.default.url_ + res.data.data[i].image
            }
            that.banQuanALListData = res.data.data;

          }).catch(error => {
        })
          .then(() => {
          });
      },

    },
    //生命周期 - 创建完成（可以访问当前this实例）
    created() {
      //服务
      this.sheJifwID = localStorage.getItem('sheJifwID');
      if(this.sheJifwID){
        this.getClassifyData(this.sheJifwID);
      }else {
        this.getClassifyList();
      }

      //设计案例
      this.sheJiAL();
    },
    //生命周期 - 挂载完成（可以访问DOM元素）
    mounted() {}, //生命周期 - 创建之前
    beforeCreate() {},
    //生命周期 - 挂载之前
    beforeMount() {},
    //生命周期 - 更新之前
    beforeUpdate() {},
    //生命周期 - 更新之后
    updated() {},
    //生命周期 - 销毁之前
    beforeDestroy() {},
    //生命周期 - 销毁完成
    destroyed() {},
    //如果页面有keep-alive缓存功能，这个函数会触发
    activated() {},
  }
</script>

<style scoped>
  .top{
    height: 500px;
    min-width: 1200px;
    background: url("../assets/image/banner3.png") no-repeat;
    background-position: center center;
    background-size: cover;
    box-sizing: border-box;
    font-size: 50px;
    color: #FFFFFF;
  }
  .top p{
    font-size: 50px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    color: #FFFFFF;
    line-height: 60px;
    text-align: center;
    margin-bottom: 60px;
  }
  .content{
    width: 1200px;
    margin: auto;
  }
  .top >>> .el-tabs__nav-wrap::after{
    display: none;
  }
  .top >>> .el-tabs__item{
    width: 98px;
    height: 40px;
    border-radius: 6px;
    font-size: 24px;
    color: #fff;
    line-height: 40px;
    text-align: center;
    padding: 0px;
  }
  .top >>> .el-tabs__item.is-active{
    background: #FFFFFF;
    color: #1890FF;
  }
  .top >>> .el-tabs__active-bar{
    display: none;
  }
  .top >>> .el-tabs__nav{
    float: none;
    text-align: center;
  }
  .top >>> .el-tabs__content{
    width: 1200px;
    margin: auto;
  }
  .top >>> .el-input-group{
    width: 800px;
    margin: auto;
  }
  .title{
    text-align: center;
    font-size: 32px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    color: #1890FF;
    margin: 70px 0;
  }
  .title span{
    display: inline-block;
    margin: 0 20px;
  }
  .top >>> .el-input-group__append{
    background-color: #1890FF;
    color: #FFFFFF;
    font-size: 22px;
    border: none;
  }
  .top >>> .el-input__inner{
    height: 60px;
    font-size: 18px;
  }
  .fL{
    height: 500px;
    border-radius: 10px;
    border: 1px solid #B7B7B7;
    overflow: auto;
    margin-bottom: 60px;
  }
  .fL >>> .el-tabs--left,
  .fL >>> .el-tabs__content,
  .fL >>> .el-tabs__content .el-tab-pane{
    height: 100%;
  }
  .el-tabs--left >>> .el-tabs__header.is-left{
    width: 180px;
    margin-right: 0;
    background: url("../assets/image/bg_z2.png") no-repeat;
    background-position: center center;
    background-size: cover;
    padding-top: 20px;
    box-sizing: border-box;
  }
  .el-tabs--left >>> .el-tabs__active-bar.is-left{
    display: none;
  }
  .el-tabs--left >>> .el-tabs__item.is-left{
    width: 128px;
    background: #FFFFFF;
    margin: auto;
    margin-bottom: 20px;
    border-radius: 6px;
    text-align: center;
    font-size: 16px;
  }
  .left p{
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: #FFFFFF;
    margin-top: 50px;
    margin-bottom: 25px;
  }
  .classify{
    width: 244px;
    height: 231px;
    background: #FFFFFF;
    border-radius: 10px;
    margin: auto;
    padding: 20px;
    box-sizing: border-box;
  }
  .classify ul li{
    width: 33%;
    margin-bottom: 28px;
    cursor: pointer;
  }
  .classify ul li:hover{
    color: #1890FF;
  }
  .left .el-input{
    width: 244px;
    margin: auto;
    display: block;
    margin-bottom: 100px;
  }
  .right{
    width: calc(100% - 300px);
    height: 500px;
    float: left;
  }
  .el-carousel__item h3 {
    color: #475669;
    font-size: 18px;
    opacity: 0.75;
    line-height: 300px;
    margin: 0;
  }
  .el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
  }
  .el-carousel__item:nth-child(2n+1) {
    background-color: #d3dce6;
  }
  .sbjs >>> .el-card{
    width: 330px;
    height: 350px;
    box-sizing: border-box;
  }
  .sbjs{
    padding-bottom: 80px;
  }
  .sbjs .box-card p:nth-of-type(1){
    color: #333333;
    font-weight: bold;
    font-size: 18px;
  }
  .sbjs .box-card p:nth-of-type(2){
    color: #666666;
    font-size: 16px;
    text-align: center;
    line-height: 26px;
  }
  .sbjs  .box-card img{
    margin-bottom: 22px;
  }
  .sjfw{
    position: relative;
    padding-left: 170px;
    box-sizing: border-box;
    margin-bottom: 20px;
  }
  .sjfw p:nth-of-type(1){
    font-weight: bold;
    color: #333333;
    font-size: 20px;
  }
  .sjfw p:nth-of-type(2){
    font-size: 16px;
    font-weight: 400;
    color: #666666;
    line-height: 26px;
    margin-top: 20px;
  }
  .sjfw img{
    position: absolute;
    left: 30px;
  }
  .SBAL{
    margin-top: 80px;
    background: #F6F7F9;
    overflow: auto;
  }
  .SBAL .title{
    padding-top: 70px;
    margin: 0;
    margin-bottom: 70px;
  }
  .SBAL >>> .el-row{
    width: 1200px;
    margin: auto!important;
    padding-bottom: 50px;
  }
  .box-card img{
    display: block;
    margin: auto;
    margin-bottom: 30px;
    /*max-height: 200px;*/
    max-width: 200px;
  }
  .SBAL >>> .el-card{
    height: 350px;
  }
  .box-card p:nth-of-type(1){
    text-align: center;
    margin-bottom: 15px;
  }
  .SBZS >>> .el-tabs__nav-scroll{
    padding-left: 50px;
  }
  .SBZS >>> .el-tabs__item{
    font-size: 18px;
  }
  .SBZS >>> .el-tabs__header{
    margin-bottom: 60px;
  }
  .SBZS .el-col-6{
    margin-bottom: 30px;
  }
  .top > div{
    text-align: center;
  }
</style>
